import {
  IsArray,
  IsNotEmpty,
  IsNumber,
  IsString,
  Length,
  Min,
} from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class CreateGoodsDto {
  @ApiProperty({ description: '商品标题', example: '全新iPhone 14 Pro' })
  @IsString()
  @IsNotEmpty()
  @Length(2, 100)
  title: string;

  @ApiProperty({ description: '商品描述', example: '全新未拆封，支持验机' })
  @IsString()
  @IsNotEmpty()
  description: string;

  @ApiProperty({ description: '商品价格', example: 5999.99 })
  @IsNumber()
  @Min(0)
  price: number;

  @ApiProperty({ description: '商品图片URL数组', example: ['url1', 'url2'] })
  @IsArray()
  @IsString({ each: true })
  images: string[];

  @ApiProperty({ description: '商品分类ID', example: 1 })
  @IsNumber()
  @IsNotEmpty()
  categoryId: number;
}
